﻿<template>
  <div id="toolbar">
    <span class = 'workflow_return' title = '返回流程管理页面' @click = 'returnToWorkflowMag'><i class = 'el-icon-back'></i></span>
    <i data-command = "undo" class = "command iconfont icon-fanhuishangyibu-" title="撤销"></i>
    <span class = "separator"></span>
    <i data-command = "redo" class = "command iconfont icon-fanhuixiayibu-" title="重做"></i>
    <span class = "separator"></span>
    <i data-command = "copy" class = "command iconfont icon-fuzhi1" title="复制"></i>
    <span class = "separator"></span>
    <i data-command = "paste" class = "command iconfont icon-fuzhi" title="粘贴" ></i>
    <span class = "separator"></span>
    <i data-command = "delete" class = "command iconfont icon-shanchu" title="删除" ></i>
    <span class = "separator"></span>
    <i data-command = "zoomIn" class = "command iconfont icon-fangda" title="放大"></i>
    <span class = "separator"></span>
    <i data-command = "zoomOut" class = "command iconfont icon-unie039" title="缩小" ></i>
    <span class = "separator"></span>
    <el-radio-group v-model = "lineType" size = "mini" class = 'my_radioGroup'>
      <el-radio-button label = "flow-smooth" title = "直线"><i class = "iconfont icon-jiantou_youshang"></i></el-radio-button>
      <el-radio-button label = "flow-polyline-round" title = "折线"><i class = "iconfont icon-hj2"></i></el-radio-button>
    </el-radio-group>
    <el-button @click = "$emit('save')" size='mini' type = 'primary' title = "保存" :disabled = "currentVersionStatus === 1"><i class="iconfont icon-baocun-xianxing"></i></el-button>
    <el-button @click = "$emit('submit')" size='mini' type = 'primary' title = "发布" :disabled = "currentVersionStatus === 1"><i class="iconfont icon-upload"></i></el-button>
    <el-button @click = "$emit('addPlus')" size='mini' type = 'primary' title = "新建" :disabled = "hadUnpublishedVersion"><i class="iconfont icon-add"></i></el-button>
    <el-button @click = "$emit('delCurrent')" size='mini' type = 'primary' title = "删除当前版本" :disabled = "currentVersionStatus === 1"><i class="iconfont icon-shanchu"></i></el-button>
  </div>
</template>
<script>
export default {
  props: ['currentVersionStatus', 'hadUnpublishedVersion'],
  data () {
    return {
      name: 'toolbar',
      lineType: 'flow-smooth'
    }
  },
  methods: {
    // 点击返回流程管理的按钮时
    returnToWorkflowMag () {
      this.$confirm('返回前,请检查您的流程图是否已保存', '提示', {
        confirmButtonText: '确定',
        cancelButtonClass: 'el-button--info',
        cancelButtonText: '取消'
      }).then(() => {
        this.$router.push('/dashboard/workflowManagement')
      }).catch(() => { })
    }
  },
  watch: {
    lineType (value) {
      this.$emit('change-eage', value)
    }
  }
}
</script>
